package com.larry.mr.index;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * @author larry
 * @Title: map-reduce
 * @Package com.larry.mr.index
 * @Description: TODO
 * @date 2022/5/1721:03
 */
public class TwoIndexMapper extends Mapper<LongWritable, Text,Text,Text> {
    Text k = new Text();
    Text v = new Text();
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {

        String[] fields = value.toString().split("--");

        k.set(fields[0]);
        v.set(fields[1]);

        context.write(k,v);

    }
}
